'use strict';

const THECACHE = Symbol('Context#THECACHE');
const THEUSER = Symbol('Context#THEUSER');

module.exports = {

  get connBlog() {
    return this.app.connBlog;
  },

  get theCache() {
    return this.app.theCache;
  },

  get func() {
    return this.helper;
  },

  get theUser() {
    if (!this[THEUSER]) {
      this[THEUSER] = this.service.user;
    }
    return this[THEUSER];
  },

  // Generate Security Code
  genSecurityCode() {
    if (this.session.lbsSecurityCode == undefined || this.session.lbsSecurityCode.length != 4) {
      this.session.lbsSecurityCode = this.helper.randomStr(4, '0123456789');
    }
  },

};
